{% extends "base.html" %}
{% load i18n %}

{% block navigation %}
	<ul class="nav navbar-nav">
		<li><a href="{% url 'home' %}">Index</a></li>
		{% if user.is_authenticated %}
		  <li class="active"><a href="{% url 'import' %}">Import</a></li>
        {% endif %}
		<li>
		{% if user.is_authenticated %}
          <a href="{% url 'accounts_logout' %}" target="parent" title="Logout">{% trans "<< Logout >>" %}</a>
        {% else %}
          <a href="{% url 'accounts_login' %}" target="parent" title="Login">{% trans "<< Login >>" %}</a>
        {% endif %}
		</li>
	</ul>
{% endblock %}

{% block content %}

<section class="cols">
<div class="col">    
      {% if languages %}
      <form id="frm1" action="/mng/import/" method="post" > {% csrf_token %}
        {% trans "Active language" %}: 
        <select name="lang" onchange="this.form.submit()">
		{% for l in languages %}
		  <option value="{{ l.value }}" {% if l.value == sel_lang %} selected="selected" {% endif %} > {% trans l.name %} </option>
		{% endfor %}
		</select>
      </form>
      {% endif %}
      <form id="frm2" action="/mng/import/" method="post" enctype="multipart/form-data" accept-charset="utf-8"> {% csrf_token %}
		<input type="hidden" name="sel_lang" value="{{sel_lang}}" />
		{% trans "File" %}:
        <input type="file" name="xml" />
        <input id="action" type="submit" name="action" value="{% trans "Import class data" %}" onClick="formSubmit('frm2', 'action', 'Import');"/>
      </form>
</div>
{% if ID != "" %}
<div class="col">    
    {% trans "Importing class:" %} {{ID}} ({{sel_lang}})
</div>
{% endif %}
{% if status != "" %}
<div class="col">    
    {% trans status %} {% if errmsg != "" %} : {% trans errmsg %} {% endif %}
</div>
{% endif %}
</section>

{% endblock %}

{% block footer %}
<p class="text-center credit"></p>
{% endblock %}